﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Resources;
using System.Text;
using Tabber.Forms;

namespace Tabber.Util
{
    public class TabberCommon
    {
        #region Da ngon ngu
        public static CultureInfo Culture;
        public static ResourceManager Rm;
        public static string CurrentLanguage;

        /// <summary>
        /// SEt lai ngon ngu dang su dung
        /// </summary>
        /// <param name="location"></param>
        public static void SetLanguage(string location)
        {
            CurrentLanguage = location;
            Culture = CultureInfo.CreateSpecificCulture(location);
            Rm = new ResourceManager("Tabber.Localization.Localization", typeof(AgentManagement).Assembly);
        }

        /// <summary>
        /// Lay text tuy theo ngon ngu
        /// </summary>
        /// <param name="name"></param>
        public static string GetString(string name)
        {
            try
            {
                return Rm.GetString(name, Culture);
            }
            catch (Exception)
            {
                return string.Empty;
            }
        }
        #endregion

        #region Dong form
        /// <summary>
        /// Bien luu doi tuong form chay dau tien
        /// </summary>
        public static AgentManagement InitForm = null;

        /// <summary>
        /// Dong toan bo chuong trinh
        /// </summary>
        public static void CloseProgram()
        {
            if (InitForm != null)
            {
                InitForm.Close();
            }
        }
        #endregion

        #region Global varables

        #endregion
    }
}
